package gomz.pres.question;

import gomz.pres.GUIMain;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;
import java.awt.Insets;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ListSelectionModel;
import javax.swing.border.EmptyBorder;

/**
 * Diese Klasse erstellt das GUI der Hexagramme in der Fragensicht und das UI
 * der Hexagrammverwaltung in der Verwaltungssicht
 * 
 * @author Dilji
 */

public class GUIQHexagram {
	// all the variables for main panels
	private JPanel plHexagram;
	private JPanel plHexagramNord;
	private JScrollPane spHexagram;

	// all the variables for plHexagram
	private JLabel lbKhexname;
	private JLabel lbHHexAdminTitle;
	private JList liKlist;
	private JScrollPane spKlist;
	private JLabel lbKtxt;
	private JTextArea taKtxt;
	private JScrollPane spKtxt;
	private JLabel lbKkom;
	private JTextArea taKkom;
	private JScrollPane spKkom;
	private JLabel lbKlinesName;
	private JLabel lbKlines2Name;
	private Box linesBox;
	private ImageIcon imgLine1;
	private ImageIcon imgLine2;
	private ImageIcon imgLine3;
	private ImageIcon imgLine4;
	private JLabel lbLine1;
	private JLabel lbLine2;
	private JLabel lbLine3;
	private JLabel lbLine4;
	private JLabel lbLine5;
	private JLabel lbLine6;
	private Box btKbox;
	private JButton btKsave;
	private JButton btKcancel;

	// all the variables for LinHex
	private JPanel plLinHex;
	private ButtonGroup rbLineGroup;
	private ImageIcon imgPfeil;
	private JRadioButton rbLine1;
	private JRadioButton rbLine2;
	private JRadioButton rbLine3;
	private JRadioButton rbLine4;
	private JRadioButton rbLine5;
	private JRadioButton rbLine6;
	private JLabel lb2Line1;
	private JLabel lb2Line2;
	private JLabel lb2Line3;
	private JLabel lb2Line4;
	private JLabel lb2Line5;
	private JLabel lb2Line6;
	private JLabel lbPfeil;
	private String hexName;

	/**
	 * Erstellt das GUI fuer alle Hexagramme in der Home-Ansicht sowie das GUI
	 * der Hexagrammverwaltung in der Verwaltung-Sicht
	 * 
	 * @param isNotLinHex gibt an ob es sich um das GUI des Linienhexagramms
	 * 				handelt um enstprechende Methode aufzurufen						
	 * @param spHexSelection das ist die Liste mit allen Hexagrammen fuer die
	 * 				Hexagrammverwaltung in der Verwaltungsicht
	 * @return gibt das GUI zurueck
	 */
	public JScrollPane getTab(boolean isNotLinHex, JScrollPane spHexSelection) {

		// initialize the panels, add to scrollpane and set position
		this.plHexagram = new JPanel();
		this.plHexagramNord = new JPanel();
		this.spHexagram = new JScrollPane(plHexagramNord);
		this.plHexagramNord.setLayout(new BorderLayout());
		this.plHexagramNord.add(plHexagram, BorderLayout.NORTH);
		this.plHexagramNord.setBorder(new EmptyBorder((2 * GUIMain.getAbstand()), 0, (2 * GUIMain.getAbstand()), 0));

		// set background of main panels
		this.plHexagram.setBackground(Color.WHITE);
		this.plHexagramNord.setBackground(Color.WHITE);

		// this is the title for hexagramadmin view
		this.lbHHexAdminTitle = new JLabel("Hexagrammverwaltung");
		this.lbHHexAdminTitle.setFont(GUIMain.getTitlefont());
		this.lbHHexAdminTitle.setForeground(GUIMain.getTitleblue());

		// ********************************************************************************
		// PANEL QUESTION
		// ********************************************************************************

		// Liste fuer verschiedene Sichten
		String listData[] = { "Kommentar", "Urteil", "Bild", "Linie 1",
				"Linie 2", "Linie 3", "Linie 4", "Linie 5", "Linie 6" };
		// initialize the components of question
		this.lbKhexname = new JLabel(this.hexName);
		this.liKlist = new JList(listData);
		this.spKlist = new JScrollPane(liKlist);
		this.lbKtxt = new JLabel("Auswahl Liste:");
		this.taKtxt = new JTextArea("TextArea Liste");
		this.spKtxt = new JScrollPane(taKtxt);
		this.lbKkom = new JLabel("Pers\u00f6nlicher Kommentar aus Liste:");
		this.taKkom = new JTextArea("TextArea Kommentar");
		this.spKkom = new JScrollPane(taKkom);
		this.lbKlinesName = new JLabel();
		this.lbKlines2Name = new JLabel();

		// hier name des Hexagramms
		this.lbKlinesName.setText(hexName);

		// list single selection
		this.liKlist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

		// initialize buttons and set size
		this.btKsave = new JButton("Speichern");
		this.btKcancel = new JButton("Zur\u00fccksetzten");
		this.btKsave.setPreferredSize(new Dimension(GUIMain.getBtWidth(),GUIMain.getBtHeight()));
		this.btKsave.setMaximumSize(new Dimension(GUIMain.getBtWidth(), GUIMain.getBtHeight()));
		this.btKcancel.setPreferredSize(new Dimension(GUIMain.getBtWidth(),	GUIMain.getBtHeight()));
		this.btKcancel.setMaximumSize(new Dimension(GUIMain.getBtWidth(), GUIMain.getBtHeight()));

		// BOX
		this.btKbox = Box.createHorizontalBox();
		btKbox.add(btKsave);
		btKbox.add(Box.createHorizontalStrut(GUIMain.getAbstand()));
		btKbox.add(btKcancel);

		// size of scrollpane from list
		this.spKlist.setPreferredSize(new Dimension(160, 200));
		this.spKlist.setMaximumSize(new Dimension(160, 200));
		this.spKlist.setBorder(GUIMain.getBorderColor());

		// size of scrollpane and format
		this.spKtxt.setPreferredSize(new Dimension(500, 200));
		this.spKtxt.setMaximumSize(new Dimension(500, 200));
		this.spKtxt.setBorder(BorderFactory.createCompoundBorder(
				GUIMain.getBorderColor(), GUIMain.getBorderInGapScrollPane()));
		this.spKtxt.setBackground(null);
		this.spKkom.setPreferredSize(new Dimension(500, 200));
		this.spKkom.setMaximumSize(new Dimension(500, 200));
		this.spKkom.setBorder(BorderFactory.createCompoundBorder(
				GUIMain.getBorderColor(), GUIMain.getBorderInGapScrollPane()));
		this.spKkom.setBackground(null);

		// format taKtxt
		// true to set formatting
		this.taKtxt.setOpaque(true);
		// user can not edit this JTextArea
		this.taKtxt.setEditable(false);
		// set automatically linewrap
		this.taKtxt.setLineWrap(true);
		// set wrap style word
		this.taKtxt.setWrapStyleWord(true);
		// font
		this.taKtxt.setFont(this.lbKtxt.getFont());
		// font inactive
		this.taKtxt.setForeground(GUIMain.getFontcolorinactive());

		// format taKkom
		// true to set formatting
		this.taKkom.setOpaque(true);
		// user can not edit this JTextArea
		this.taKkom.setEditable(true);
		// set automatically linewrap
		this.taKkom.setLineWrap(true);
		// set wrap style word
		this.taKkom.setWrapStyleWord(true);
		// font
		this.taKkom.setFont(this.lbKkom.getFont());

		// initialize the images for lines and set size
		this.imgLine1 = new ImageIcon(getClass().getResource(
				"/gomz/img/line1.png"));
		this.imgLine1.setImage(imgLine1.getImage().getScaledInstance(250, 40,
				Image.SCALE_DEFAULT));
		this.imgLine2 = new ImageIcon(getClass().getResource(
				"/gomz/img/line2.png"));
		this.imgLine2.setImage(imgLine2.getImage().getScaledInstance(250, 40,
				Image.SCALE_DEFAULT));
		this.imgLine3 = new ImageIcon(getClass().getResource(
				"/gomz/img/line3.png"));
		this.imgLine3.setImage(imgLine3.getImage().getScaledInstance(250, 40,
				Image.SCALE_DEFAULT));
		this.imgLine4 = new ImageIcon(getClass().getResource(
				"/gomz/img/line4.png"));
		this.imgLine4.setImage(imgLine4.getImage().getScaledInstance(250, 40,
				Image.SCALE_DEFAULT));

		// initialize the labels for lines
		this.lbLine1 = new JLabel();
		this.lbLine2 = new JLabel();
		this.lbLine3 = new JLabel();
		this.lbLine4 = new JLabel();
		this.lbLine5 = new JLabel();
		this.lbLine6 = new JLabel();

		// set lines to labels
		this.lbLine1.setIcon(imgLine3);
		this.lbLine2.setIcon(imgLine1);
		this.lbLine3.setIcon(imgLine1);
		this.lbLine4.setIcon(imgLine2);
		this.lbLine5.setIcon(imgLine4);
		this.lbLine6.setIcon(imgLine1);

		// BOX for icons
		this.linesBox = Box.createVerticalBox();
		this.linesBox.add(lbLine1);
		this.linesBox.add(Box.createVerticalStrut(GUIMain.getAbstand()));
		this.linesBox.add(lbLine2);
		this.linesBox.add(Box.createVerticalStrut(GUIMain.getAbstand()));
		this.linesBox.add(lbLine3);
		this.linesBox.add(Box.createVerticalStrut(GUIMain.getAbstand()));
		this.linesBox.add(lbLine4);
		this.linesBox.add(Box.createVerticalStrut(GUIMain.getAbstand()));
		this.linesBox.add(lbLine5);
		this.linesBox.add(Box.createVerticalStrut(GUIMain.getAbstand()));
		this.linesBox.add(lbLine6);

		// ueberpruefen ob normal oder LinHex angezeigt werden soll
		if (isNotLinHex) {
			viewNormalHex(spHexSelection);
		} else {
			viewLinHex();
		}

		// scroll speed
		this.spHexagram.getVerticalScrollBar().setUnitIncrement(GUIMain.getScrollspeed());
		this.spKkom.getVerticalScrollBar().setUnitIncrement(GUIMain.getScrollspeed());
		this.spKlist.getVerticalScrollBar().setUnitIncrement(GUIMain.getScrollspeed());
		this.spKtxt.getVerticalScrollBar().setUnitIncrement(GUIMain.getScrollspeed());
		this.spKtxt.getVerticalScrollBar().getModel().setValue(0);
		this.spKlist.getVerticalScrollBar().getModel().setValue(0);
		this.spKtxt.getVerticalScrollBar().getModel().setValue(0);

		return (spHexagram);
	}

	/**
	 * Diese Methode erstellt das GUI aller Hexagramme ausser fuer das Linienhexagramm
	 * 
	 * @param spHexSelection Liste fuer die verschiedenen Sichten pro Hexagramm
	 */
	private void viewNormalHex(JScrollPane spHexSelection) {

		/*
		 * Falls Hexselection mitgegeben wurde, sind wir in der Verwaltung
		 * Texte bearbeiten moeglich (textarea editable true)
		 * und Schriftfaarbe auf schwarz setzten
		 */
		if (spHexSelection != null) {
			this.taKtxt.setEditable(true);
			this.taKtxt.setForeground(Color.BLACK);
		}

		// position of components
		this.plHexagram.setLayout(new GridBagLayout());
		GridBagConstraints ch = new GridBagConstraints();
		ch.fill = GridBagConstraints.HORIZONTAL; // Zellen in x-Achse fuellen
		ch.insets = new Insets(GUIMain.getAbstand(), GUIMain.getAbstand(), 0, GUIMain.getAbstand());

		ch.anchor = GridBagConstraints.SOUTH; // Ausrichtung unten
		ch.gridx = 0; // Spalte 1
		ch.gridy = 0; // Zeile 1
		// Falls Hexselection mitgegeben wurde, Hexagrammverwaltungtitel anzeigen sonst Hexagrammname
		plHexagram.add((spHexSelection == null ? lbKhexname : lbHHexAdminTitle), ch);
		ch.insets = new Insets(GUIMain.getAbstand(), GUIMain.getAbstand() + 15, 0, GUIMain.getAbstand());
		ch.gridx = 1; // Spalte 2
		ch.gridy = 0; // Zeile 1
		plHexagram.add(lbKlinesName, ch); // Name des Hexagramms
		ch.insets = new Insets(GUIMain.getAbstand(), GUIMain.getAbstand(), 0, GUIMain.getAbstand());
		ch.gridx = 2; // Spalte 3
		ch.gridy = 0; // Zeile 1
		plHexagram.add(lbKtxt, ch); // Label Liste

		ch.anchor = GridBagConstraints.NORTHWEST; // Ausrichtung oben
		ch.gridx = 0; // Spalte 1
		ch.gridy = 1; // Zeile 2
		if (spHexSelection != null) {ch.gridheight = 4;}
			
		// Falls Hexselection mitgegeben wurde diese anzeigen sonst KList
		plHexagram.add((spHexSelection == null ? spKlist : spHexSelection), ch);
		ch.insets = new Insets(GUIMain.getAbstand(), GUIMain.getAbstand() + 15,	0, GUIMain.getAbstand() + 15);
		ch.gridx = 1; // Spalte 2
		ch.gridy = 1; // Zeile 2
		ch.gridheight = 4;
		plHexagram.add(linesBox, ch); // TextField Benutzer
		ch.insets = new Insets(GUIMain.getAbstand(), GUIMain.getAbstand(), 0, GUIMain.getAbstand());
		ch.gridx = 2; // Spalte 3
		ch.gridy = 1; // Zeile 2
		ch.gridheight = 1;
		plHexagram.add(spKtxt, ch); // Leer

		ch.gridx = 0; // Spalte 1
		ch.gridy = 2; // Zeile 3
		ch.gridheight = 3;
		// falls Hexselection mitgegeben wurde, KList anzeigen sonst nichts
		if (spHexSelection != null) {plHexagram.add(spKlist, ch);}
		ch.gridheight = 1;
		ch.gridx = 1; // Spalte 2
		ch.gridy = 2; // Zeile 3
		// plHexagram.add(, ch); // Leer
		ch.gridx = 2; // Spalte 3
		ch.gridy = 2; // Zeile 3
		plHexagram.add(lbKkom, ch); // Leer

		ch.gridx = 0; // Spalte 1
		ch.gridy = 3; // Zeile 4
		// plHexagram.add(, ch); // Leer
		ch.gridx = 1; // Spalte 2
		ch.gridy = 3; // Zeile 4
		// plHexagram.add(, ch); // Leer
		ch.gridx = 2; // Spalte 3
		ch.gridy = 3; // Zeile 4
		plHexagram.add(spKkom, ch); // TextArea Kommentar

		ch.gridx = 0; // Spalte 1
		ch.gridy = 4; // Zeile 5
		// plHexagram.add(, ch); // Leer
		ch.gridx = 1; // Spalte 2
		ch.gridy = 4; // Zeile 5
		// plHexagram.add(, ch); // Leer
		ch.gridx = 2; // Spalte 3
		ch.gridy = 4; // Zeile 5
		plHexagram.add(btKbox, ch); // Buttons
	}

	/**
	 * Diese Methode erstellt das GUI fuer das Linienhexagramm
	 */
	private void viewLinHex() {

		// initialize components
		this.plLinHex = new JPanel();
		this.plLinHex.setBackground(Color.WHITE);
		this.rbLine1 = new JRadioButton();
		this.rbLine2 = new JRadioButton();
		this.rbLine3 = new JRadioButton();
		this.rbLine4 = new JRadioButton();
		this.rbLine5 = new JRadioButton();
		this.rbLine6 = new JRadioButton();
		this.lb2Line1 = new JLabel();
		this.lb2Line2 = new JLabel();
		this.lb2Line3 = new JLabel();
		this.lb2Line4 = new JLabel();
		this.lb2Line5 = new JLabel();
		this.lb2Line6 = new JLabel();
		this.imgPfeil = new ImageIcon(getClass().getResource("/gomz/img/pfeil.png"));
		this.lbPfeil = new JLabel();
		this.lbPfeil.setIcon(imgPfeil);

		// set lines to labels
		this.lb2Line1.setIcon(imgLine1);
		this.lb2Line2.setIcon(imgLine2);
		this.lb2Line3.setIcon(imgLine3);
		this.lb2Line4.setIcon(imgLine4);
		this.lb2Line5.setIcon(imgLine2);
		this.lb2Line6.setIcon(imgLine1);

		// set white background of radiobuttons
		this.rbLine1.setBackground(Color.WHITE);
		this.rbLine2.setBackground(Color.WHITE);
		this.rbLine3.setBackground(Color.WHITE);
		this.rbLine4.setBackground(Color.WHITE);
		this.rbLine5.setBackground(Color.WHITE);
		this.rbLine6.setBackground(Color.WHITE);

		// initialize ButtonGroup and add RadioButtons
		this.rbLineGroup = new ButtonGroup();
		this.rbLineGroup.add(rbLine1);
		this.rbLineGroup.add(rbLine2);
		this.rbLineGroup.add(rbLine3);
		this.rbLineGroup.add(rbLine4);
		this.rbLineGroup.add(rbLine5);
		this.rbLineGroup.add(rbLine6);

		// size of buttons
		this.btKsave.setPreferredSize(new Dimension(GUIMain.getBtWidth(),GUIMain.getBtHeight()));
		this.btKsave.setMaximumSize(new Dimension(GUIMain.getBtWidth(), GUIMain.getBtHeight()));
		this.btKcancel.setPreferredSize(new Dimension(GUIMain.getBtWidth(),	GUIMain.getBtHeight()));
		this.btKcancel.setMaximumSize(new Dimension(GUIMain.getBtWidth(), GUIMain.getBtHeight()));

		// BOX for save butoon
		Box saveButtonBox = Box.createHorizontalBox();
		saveButtonBox.add(btKsave);

		// BOX for cancel butoon
		Box cancelButtonBox = Box.createHorizontalBox();
		cancelButtonBox.add(btKcancel);

		// position of components
		this.plLinHex.setLayout(new GridBagLayout());
		GridBagConstraints chlh = new GridBagConstraints();
		chlh.fill = GridBagConstraints.HORIZONTAL; // Zellen in x-Achse fuellen
		chlh.insets = new Insets(GUIMain.getAbstand(), GUIMain.getAbstand(), 0, GUIMain.getAbstand());
		chlh.anchor = GridBagConstraints.NORTHWEST; // Ausrichtung oben

		chlh.gridx = 0; // Spalte 1
		chlh.gridy = 0; // Zeile 1
		plLinHex.add(lbKhexname, chlh); // Hexagrammname
		chlh.gridx = 1; // Spalte 2
		chlh.gridy = 0; // Zeile 1
		// plLinHex.add(, chlh); // Leer
		chlh.gridx = 2; // Spalte 3
		chlh.gridy = 0; // Zeile 1
		plLinHex.add(lbKlinesName, chlh); // Linienhexagramm
		chlh.gridx = 3; // Spalte 4
		chlh.gridy = 0; // Zeile 1
		// plLinHex.add(, chlh); // Leer
		chlh.gridx = 4; // Spalte 5
		chlh.gridy = 0; // Zeile 1
		plLinHex.add(lbKlines2Name, chlh); // 2. Linienhexagramm

		chlh.gridx = 0; // Spalte 1
		chlh.gridy = 1; // Zeile 2
		chlh.gridheight = 6;
		plLinHex.add(spKlist, chlh); // Liste Benutzer
		chlh.insets = new Insets(GUIMain.getAbstand(),(GUIMain.getAbstand() * 5), 0, GUIMain.getAbstand());
		chlh.anchor = GridBagConstraints.CENTER; // Ausrichtung oben
		chlh.gridx = 1; // Spalte 2
		chlh.gridy = 1; // Zeile 2
		chlh.gridheight = 1;
		plLinHex.add(this.rbLine1, chlh); // CheckBox
		chlh.insets = new Insets(GUIMain.getAbstand(), GUIMain.getAbstand(), 0,	GUIMain.getAbstand());
		chlh.gridx = 2; // Spalte 3
		chlh.gridy = 1; // Zeile 2
		plLinHex.add(this.lbLine1, chlh); 
		chlh.gridx = 3; // Spalte 4
		chlh.gridy = 1; // Zeile 2
		chlh.gridheight = 6;
		plLinHex.add(lbPfeil, chlh); 
		chlh.gridx = 4; // Spalte 5
		chlh.gridy = 1; // Zeile 2
		chlh.gridheight = 1;
		plLinHex.add(this.lb2Line1, chlh);

		chlh.gridx = 0; // Spalte 1
		chlh.gridy = 2; // Zeile 3
		// plLinHex.add(, chlh); // Leer
		chlh.insets = new Insets(GUIMain.getAbstand(),(GUIMain.getAbstand() * 5), 0, GUIMain.getAbstand());
		chlh.gridx = 1; // Spalte 2
		chlh.gridy = 2; // Zeile 3
		plLinHex.add(this.rbLine2, chlh); // CheckBox
		chlh.insets = new Insets(GUIMain.getAbstand(), GUIMain.getAbstand(), 0,	GUIMain.getAbstand());
		chlh.gridx = 2; // Spalte 3
		chlh.gridy = 2; // Zeile 3
		plLinHex.add(this.lbLine2, chlh); 
		chlh.gridx = 3; // Spalte 4
		chlh.gridy = 2; // Zeile 3
		// plLinHex.add(, chlh); // Leer
		chlh.gridx = 4; // Spalte 5
		chlh.gridy = 2; // Zeile 3
		plLinHex.add(this.lb2Line2, chlh);

		chlh.gridx = 0; // Spalte 1
		chlh.gridy = 3; // Zeile 4
		// plLinHex.add(, chlh); // Leer
		chlh.insets = new Insets(GUIMain.getAbstand(),(GUIMain.getAbstand() * 5), 0, GUIMain.getAbstand());
		chlh.gridx = 1; // Spalte 2
		chlh.gridy = 3; // Zeile 4
		plLinHex.add(this.rbLine3, chlh); // CheckBox
		chlh.insets = new Insets(GUIMain.getAbstand(), GUIMain.getAbstand(), 0,	GUIMain.getAbstand());
		chlh.gridx = 2; // Spalte 3
		chlh.gridy = 3; // Zeile 4
		plLinHex.add(this.lbLine3, chlh); 
		chlh.gridx = 3; // Spalte 4
		chlh.gridy = 3; // Zeile 4
		// plLinHex.add(, chlh); // Leer
		chlh.gridx = 4; // Spalte 5
		chlh.gridy = 3; // Zeile 4
		plLinHex.add(this.lb2Line3, chlh); 

		chlh.gridx = 0; // Spalte 1
		chlh.gridy = 4; // Zeile 5
		// plLinHex.add(, chlh); // Leer
		chlh.insets = new Insets(GUIMain.getAbstand(), (GUIMain.getAbstand() * 5), 0, GUIMain.getAbstand());
		chlh.gridx = 1; // Spalte 2
		chlh.gridy = 4; // Zeile 5
		plLinHex.add(this.rbLine4, chlh); // CheckBox
		chlh.insets = new Insets(GUIMain.getAbstand(), GUIMain.getAbstand(), 0,	GUIMain.getAbstand());
		chlh.gridx = 2; // Spalte 3
		chlh.gridy = 4; // Zeile 5
		plLinHex.add(this.lbLine4, chlh); // Leer
		chlh.gridx = 3; // Spalte 4
		chlh.gridy = 4; // Zeile 5
		// plLinHex.add(, chlh); // Leer
		chlh.gridx = 4; // Spalte 5
		chlh.gridy = 4; // Zeile 5
		plLinHex.add(this.lb2Line4, chlh); // Leer

		chlh.gridx = 0; // Spalte 1
		chlh.gridy = 5; // Zeile 6
		// plLinHex.add(, chlh); // Leer
		chlh.insets = new Insets(GUIMain.getAbstand(), (GUIMain.getAbstand() * 5), 0, GUIMain.getAbstand());
		chlh.gridx = 1; // Spalte 2
		chlh.gridy = 5; // Zeile 6
		plLinHex.add(this.rbLine5, chlh); // CheckBox
		chlh.insets = new Insets(GUIMain.getAbstand(), GUIMain.getAbstand(), 0,	GUIMain.getAbstand());
		chlh.gridx = 2; // Spalte 3
		chlh.gridy = 5; // Zeile 6
		plLinHex.add(this.lbLine5, chlh);
		chlh.gridx = 3; // Spalte 4
		chlh.gridy = 5; // Zeile 6
		// plLinHex.add(, chlh); // Leer
		chlh.gridx = 4; // Spalte 5
		chlh.gridy = 5; // Zeile 6
		plLinHex.add(this.lb2Line5, chlh);

		chlh.gridx = 0; // Spalte 1
		chlh.gridy = 6; // Zeile 7
		// plLinHex.add(, chlh); // Leer
		chlh.insets = new Insets(GUIMain.getAbstand(), (GUIMain.getAbstand() * 5), 0, GUIMain.getAbstand());
		chlh.gridx = 1; // Spalte 2
		chlh.gridy = 6; // Zeile 7
		plLinHex.add(this.rbLine6, chlh); // CheckBox
		chlh.insets = new Insets(GUIMain.getAbstand(), GUIMain.getAbstand(), 0,	GUIMain.getAbstand());
		chlh.gridx = 2; // Spalte 3
		chlh.gridy = 6; // Zeile 7
		plLinHex.add(this.lbLine6, chlh); 
		chlh.gridx = 3; // Spalte 4
		chlh.gridy = 6; // Zeile 7
		// plLinHex.add(, chlh); // Leer
		chlh.gridx = 4; // Spalte 5
		chlh.gridy = 6; // Zeile 7
		plLinHex.add(this.lb2Line6, chlh); 

		// position of components
		this.plHexagram.setLayout(new GridBagLayout());
		GridBagConstraints chl2 = new GridBagConstraints();
		chl2.fill = GridBagConstraints.HORIZONTAL; // Zellen in x-Achse fuellen
		chl2.insets = new Insets(GUIMain.getAbstand(), GUIMain.getAbstand(), 0,	GUIMain.getAbstand());
		chl2.anchor = GridBagConstraints.NORTHWEST; // Ausrichtung oben

		chl2.gridx = 0; // Spalte 1
		chl2.gridy = 0; // Zeile 1
		chl2.gridwidth = 2;
		plHexagram.add(plLinHex, chl2); // oberer Teil
		chl2.gridx = 1; // Spalte 2
		chl2.gridy = 0; // Zeile 1
		chl2.gridwidth = 1;
		// plHexagram.add(, chl2); // Leer

		chl2.insets = new Insets(GUIMain.getAbstand() * 3, GUIMain.getAbstand(), 0, GUIMain.getAbstand());
		chl2.gridx = 0; // Spalte 1
		chl2.gridy = 1; // Zeile 2
		plHexagram.add(lbKtxt, chl2); // Label Text
		chl2.gridx = 1; // Spalte 2
		chl2.gridy = 1; // Zeile 2
		plHexagram.add(lbKkom, chl2); // Label Kommentar

		chl2.insets = new Insets(GUIMain.getAbstand(), GUIMain.getAbstand(), 0,	GUIMain.getAbstand());
		chl2.gridx = 0; // Spalte 1
		chl2.gridy = 2; // Zeile 3
		plHexagram.add(spKtxt, chl2); // TextArea Text
		chl2.gridx = 1; // Spalte 2
		chl2.gridy = 2; // Zeile 3
		plHexagram.add(spKkom, chl2); // TextArea Kommentar

		chl2.fill = GridBagConstraints.VERTICAL; // Zellen in y-Achse fuellen
		chl2.anchor = GridBagConstraints.NORTHEAST; // Ausrichtung oben
		chl2.gridx = 0; // Spalte 1
		chl2.gridy = 3; // Zeile 4
		plHexagram.add(saveButtonBox, chl2); // Button speichern
		chl2.fill = GridBagConstraints.HORIZONTAL; // Zellen in x-Achse fuellen
		chl2.anchor = GridBagConstraints.NORTHWEST; // Ausrichtung oben
		chl2.gridx = 1; // Spalte 2
		chl2.gridy = 3; // Zeile 4
		plHexagram.add(cancelButtonBox, chl2); // Button zuruecksetzten

	}

	// ********************************************************************************
	// Getters und Setters
	// ********************************************************************************

	public JList getLiKlist() {
		return liKlist;
	}

	public JTextArea getTaKtxt() {
		return taKtxt;
	}

	public JTextArea getTaKkom() {
		return taKkom;
	}

	public GUIQHexagram(String name) {
		this.hexName = name;
	}

	public JScrollPane getTab(boolean isNotLinHex) {
		return (getTab(isNotLinHex, null));
	}

	public JPanel getPlHexagram() {
		return plHexagram;
	}

	public void setPlHexagram(JPanel plHexagram) {
		this.plHexagram = plHexagram;
	}

	public JPanel getPlHexagramNord() {
		return plHexagramNord;
	}

	public void setPlHexagramNord(JPanel plHexagramNord) {
		this.plHexagramNord = plHexagramNord;
	}

	public JScrollPane getSpHexagram() {
		return spHexagram;
	}

	public void setSpHexagram(JScrollPane spHexagram) {
		this.spHexagram = spHexagram;
	}

	public ImageIcon getImgLine1() {
		return imgLine1;
	}

	public void setImgLine1(ImageIcon imgLine1) {
		this.imgLine1 = imgLine1;
	}

	public ImageIcon getImgLine2() {
		return imgLine2;
	}

	public void setImgLine2(ImageIcon imgLine2) {
		this.imgLine2 = imgLine2;
	}

	public ImageIcon getImgLine3() {
		return imgLine3;
	}

	public void setImgLine3(ImageIcon imgLine3) {
		this.imgLine3 = imgLine3;
	}

	public ImageIcon getImgLine4() {
		return imgLine4;
	}

	public void setImgLine4(ImageIcon imgLine4) {
		this.imgLine4 = imgLine4;
	}

	public JLabel getLbLine1() {
		return lbLine1;
	}

	public void setLbLine1(JLabel lbLine1) {
		this.lbLine1 = lbLine1;
	}

	public JLabel getLbLine2() {
		return lbLine2;
	}

	public void setLbLine2(JLabel lbLine2) {
		this.lbLine2 = lbLine2;
	}

	public JLabel getLbLine3() {
		return lbLine3;
	}

	public void setLbLine3(JLabel lbLine3) {
		this.lbLine3 = lbLine3;
	}

	public JLabel getLbLine4() {
		return lbLine4;
	}

	public void setLbLine4(JLabel lbLine4) {
		this.lbLine4 = lbLine4;
	}

	public JLabel getLbLine5() {
		return lbLine5;
	}

	public void setLbLine5(JLabel lbLine5) {
		this.lbLine5 = lbLine5;
	}

	public JLabel getLbLine6() {
		return lbLine6;
	}

	public void setLbLine6(JLabel lbLine6) {
		this.lbLine6 = lbLine6;
	}

	public JLabel getLbKlinesName() {
		return lbKlinesName;
	}

	public void setLbKlinesName(JLabel lbKlinesName) {
		this.lbKlinesName = lbKlinesName;
	}

	public JButton getBtKsave() {
		return btKsave;
	}

	public void setBtKsave(JButton btKsave) {
		this.btKsave = btKsave;
	}

	public JButton getBtKcancel() {
		return btKcancel;
	}

	public void setBtKcancel(JButton btKcancel) {
		this.btKcancel = btKcancel;
	}

	public JLabel getLbKhexname() {
		return lbKhexname;
	}

	public void setLbKhexname(JLabel lbKhexname) {
		this.lbKhexname = lbKhexname;
	}

	public JRadioButton getRbLine1() {
		return rbLine1;
	}

	public void setRbLine1(JRadioButton rbLine1) {
		this.rbLine1 = rbLine1;
	}

	public JRadioButton getRbLine2() {
		return rbLine2;
	}

	public void setRbLine2(JRadioButton rbLine2) {
		this.rbLine2 = rbLine2;
	}

	public JRadioButton getRbLine3() {
		return rbLine3;
	}

	public void setRbLine3(JRadioButton rbLine3) {
		this.rbLine3 = rbLine3;
	}

	public JRadioButton getRbLine4() {
		return rbLine4;
	}

	public void setRbLine4(JRadioButton rbLine4) {
		this.rbLine4 = rbLine4;
	}

	public JRadioButton getRbLine5() {
		return rbLine5;
	}

	public void setRbLine5(JRadioButton rbLine5) {
		this.rbLine5 = rbLine5;
	}

	public JRadioButton getRbLine6() {
		return rbLine6;
	}

	public void setRbLine6(JRadioButton rbLine6) {
		this.rbLine6 = rbLine6;
	}

	public JLabel getLb2Line1() {
		return lb2Line1;
	}

	public void setLb2Line1(JLabel lb2Line1) {
		this.lb2Line1 = lb2Line1;
	}

	public JLabel getLb2Line2() {
		return lb2Line2;
	}

	public void setLb2Line2(JLabel lb2Line2) {
		this.lb2Line2 = lb2Line2;
	}

	public JLabel getLb2Line3() {
		return lb2Line3;
	}

	public void setLb2Line3(JLabel lb2Line3) {
		this.lb2Line3 = lb2Line3;
	}

	public JLabel getLb2Line4() {
		return lb2Line4;
	}

	public void setLb2Line4(JLabel lb2Line4) {
		this.lb2Line4 = lb2Line4;
	}

	public JLabel getLb2Line5() {
		return lb2Line5;
	}

	public void setLb2Line5(JLabel lb2Line5) {
		this.lb2Line5 = lb2Line5;
	}

	public JLabel getLb2Line6() {
		return lb2Line6;
	}

	public void setLb2Line6(JLabel lb2Line6) {
		this.lb2Line6 = lb2Line6;
	}

	public JLabel getLbPfeil() {
		return lbPfeil;
	}

	public void setLbPfeil(JLabel lbPfeil) {
		this.lbPfeil = lbPfeil;
	}

	public JLabel getLbKlines2Name() {
		return lbKlines2Name;
	}

	public void setLbKlines2Name(JLabel lbKlines2Name) {
		this.lbKlines2Name = lbKlines2Name;
	}

}
